//
//  WebServiceManager.h
//  PurchasingMeeting
//
//  Created by zhuang yihang on 7/20/13.
//  Copyright (c) 2013 YX. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "RFRequest.h"

typedef void (^WebServiceCompletion)(id response);

@interface WebServiceManager : NSObject

+ (WebServiceManager *)sharedManager;

- (NSString *)baseURL;

-(void)getServerIP:(WebServiceCompletion)completion;
//登录接口
//参数：用户名，密码
- (void)login:(NSString *)name password:(NSString *)password u_id:(NSString *)u_id completion:(WebServiceCompletion)completion;

- (void)checkID:(WebServiceCompletion)completion;
- (void)SyncPic:(WebServiceCompletion)completion;

//执行SQL语句
//参数：SQL语句
- (void)excute:(NSString *)sqlString competion:(WebServiceCompletion)completion;


//获取用户登录名
- (NSString *)getUserName;

//提交订单
- (void)submit:(NSString *)orderJSON completion:(WebServiceCompletion)completion;

//产品信息
//date为nil，则返回整表信息
- (void)refreshProductInfo:(long)date completion:(WebServiceCompletion)completion;
- (void)refreshProductColorid:(long)date completion:(WebServiceCompletion)completion;
- (void)refreshProductPicture:(long)date completion:(WebServiceCompletion)completion;
- (void)refreshColortbl:(long)date completion:(WebServiceCompletion)completion;
- (void)refreshXilie:(long)date completion:(WebServiceCompletion)completion;
- (void)refreshKuans:(long)date completion:(WebServiceCompletion)completion;
- (void)refreshKuanx:(long)date completion:(WebServiceCompletion)completion;
- (void)refreshXiaoxl:(long)date completion:(WebServiceCompletion)completion;
- (void)refreshNianf:(long)date completion:(WebServiceCompletion)completion;
- (void)refreshJijie:(long)date completion:(WebServiceCompletion)completion;
- (void)refreshPingp:(long)date completion:(WebServiceCompletion)completion;
- (void)refreshSpdmStatusTimeInfo:(NSDate *)date completion:(WebServiceCompletion)completion;
- (void)refreshSizeInfo:(WebServiceCompletion)completion;
- (void)refreshSaleSegment:(WebServiceCompletion)completion;

- (RFRequest *)getSpdmSizeTableRequest:(NSDate *)date;
- (void)refreshSpdmSizeTable:(NSDate *)date completion:(WebServiceCompletion)completion;

- (RFRequest *)getProductInfoRequest:(long)date;
- (RFRequest *)getProductColoridRequest:(long)date;
- (RFRequest *)getProductPictureRequest:(long)date;
- (RFRequest *)getColortblRequest:(long)date;
- (RFRequest *)getXilieRequest:(long)date;
- (RFRequest *)getKuansRequest:(long)date;
- (RFRequest *)getKuanxRequest:(long)date;
- (RFRequest *)getXiaoxlRequest:(long)date;
- (RFRequest *)getNianfRequest:(long)date;
- (RFRequest *)getJijieRequest:(long)date;
- (RFRequest *)getPingpRequest:(long)date;
- (RFRequest *)getSpdmStatusTimeInfoRequest:(NSDate *)date;

//订单表
- (void)refreshOrderTable:(long)date completion:(WebServiceCompletion)completion;
- (RFRequest *)getOrderTableRequest:(long)date;

- (RFRequest *)getg_SizeTableRequest:(long)date;
- (void)refreshg_SizeTable:(long)date completion:(WebServiceCompletion)completion;
//配装主表
- (void)refreshPMTable:(NSDate *)date completion:(WebServiceCompletion)completion;
- (RFRequest *)getPMTableRequest:(NSDate *)date;
//配装从表
- (void)refreshPDTable:(NSString *)scripno completion:(WebServiceCompletion)completion;
- (RFRequest *)getPDTableRequest:(NSString *)scripno;

//商品过滤类别表
- (void)refreshReferenceTable:(WebServiceCompletion)completion;

//获取尺码表
- (void)refreshSizeTable:(WebServiceCompletion)completion;

//获取通知表
- (void)refreshTipsTable:(NSDate *)date completion:(WebServiceCompletion)completion;

//获取用户已下订单的列表
- (void)getShopOrderList:(NSString *)shopid completion:(WebServiceCompletion)completion;


//获取服务器报表数据
- (void)getShopList:(NSString *)usercode completion:(WebServiceCompletion)completion;

- (void)getServerReport:(NSString *)usercode
                 ShopID:(NSString*)shopid
                    SKU:(NSString*)sku
              QueryType:(NSString*)queryType
             completion:(WebServiceCompletion)completion;

- (void)setNewPassword:(NSString *)usercode password:(NSString *)password completion:(WebServiceCompletion)completion;

- (void)checktotal:(NSString*)usercode count:(NSString *)count money:(NSString*)money completion:(WebServiceCompletion)completion;
-(void)checkShopTotal:(NSString*)shopid count:(NSString *)count money:(NSString*)money completion:(WebServiceCompletion)competion;

- (void)checkShop:(NSString *)shopid completion:(WebServiceCompletion)completion;

- (void)VeriShop:(NSString *)usercode password:(NSString *)password shopid:(NSString *)shopid completion:(WebServiceCompletion)completion;

- (void)VeriShop:(NSString *)u_id shopid:(NSString *)shopid completion:(WebServiceCompletion)completion;

-(void)setnewServerIP:(BOOL)sender;

- (void)gettip:(NSString *)usercode time:(NSString *)time completion:(WebServiceCompletion)completion;

- (RFRequest *)getTipRequest:(NSString *)usercode date:(NSString *)date;

- (void)getSpdmOrder:(WebServiceCompletion)completion;


//强制上传本地订单到服务器
- (void)forceUpdateOrder:(WebServiceCompletion)completion shop:(NSString *)shopid orders:(NSString*)orders user:(NSString*)user;

- (void)cleardeviceid:(NSString *)usercode completion:(WebServiceCompletion)competion;

- (void)forceIncreaseUpdateOrder:(WebServiceCompletion)completion shop:(NSString *)shopid orders:(NSString*)orders user:(NSString*)user;
@end
